﻿CREATE TABLE [config].[DbMaintenance] (
    [ServerName]             [sysname] NOT NULL,
    [DbName]                 [sysname] NOT NULL,
    [FullBackupSchedule]     INT       CONSTRAINT [dboConfigDbMaintenanceFullBackupScheduleDefault] DEFAULT ((127)) NOT NULL,
    [FullBackupTime]         INT       CONSTRAINT [dboConfigDbMaintenanceFullBackupTimeDefault] DEFAULT ((40000)) NOT NULL,
    [DiffBackupSchedule]     INT       CONSTRAINT [dboConfigDbMaintenanceDiffBackupScheduleDefault] DEFAULT ((127)) NOT NULL,
    [DiffBackupTime]         INT       CONSTRAINT [dboConfigDbMaintenanceDiffBackupTimeDefault] DEFAULT ((120000)) NOT NULL,
    [DiffBackupFrequency]    INT       CONSTRAINT [dboConfigDbMaintenanceDiffBackupFrequencyDefault] DEFAULT ((24)) NOT NULL,
    [BackupSets]             INT       CONSTRAINT [dboConfigDbMaintenanceBackupSetsDefault] DEFAULT ((2)) NOT NULL,
    [BackupAgent]            NCHAR (3) CONSTRAINT [dboConfigDbMaintenanceBackupAgentDefault] DEFAULT ('SQL') NOT NULL,
    [DefragThreshold]        INT       CONSTRAINT [dboConfigDbMaintenanceDefragThresholdDefault] DEFAULT ((10)) NOT NULL,
    [DefragWeekSchedule]     INT       CONSTRAINT [dboConfigDbMaintenanceDefragWeekScheduleDefault] DEFAULT ((127)) NOT NULL,
    [DefragDaySchedule]      INT       CONSTRAINT [dboConfigDbMaintenanceDefragDayScheduleDefault] DEFAULT ((16)) NOT NULL,
    [CheckDbWeekSchedule]    INT       CONSTRAINT [dboConfigDbMaintenanceCheckDbWeekScheduleDefault] DEFAULT ((127)) NOT NULL,
    [CheckDbDaySchedule]     INT       CONSTRAINT [dboConfigDbMaintenanceCheckDbDayScheduleDefault] DEFAULT ((16)) NOT NULL,
    [Enabled]                BIT       CONSTRAINT [dboConfigDbMaintenanceEnabledDefault] DEFAULT ((1)) NOT NULL,
    [Id]                     INT       IDENTITY (1, 1) NOT NULL,
    [MaintenanceWindow]      INT       CONSTRAINT [ConfigDbMaintenanceMaintenanceWindowDF] DEFAULT ((240)) NOT NULL,
    [UpdateStatsDaySchedule] INT       CONSTRAINT [dboConfigDbMaintenanceUpdateStatsScheduleDefaultConstraint] DEFAULT ((16)) NOT NULL,
    [StatsLatency]           INT       CONSTRAINT [dboConfigDbMaintenanceStatsLatencyDefaultConstraint] DEFAULT ((0)) NOT NULL,
    [ErrorStatus]            INT       CONSTRAINT [dboConfigDbMaintenanceErrorStatusDefaultConstraint] DEFAULT ((0)) NOT NULL,
    [DeviceDoP]              INT       CONSTRAINT [configDbMaintenanceBackupDevicesDefault] DEFAULT ((1)) NOT NULL,
    CONSTRAINT [PK_ConfigDbMaintenance] PRIMARY KEY CLUSTERED ([ServerName] ASC, [DbName] ASC)
);

